package com.token.iot.bratterycharging.gateway.api;

import java.io.Serializable;

import com.outstanding.framework.core.BaseEnum;

public enum PortState implements BaseEnum<PortState, String>,Serializable {
	/**  */
	FREE("1", "空闲"),
	/** 正在使用 */
	USEING("2", "正在使用"),
	/** 禁用 */
	FORBIDDEN("3", "禁用"),
	
	FAULT("4","故障")
	;

	private String code;

	private String name;

	private PortState(String code, String name) {
		this.code = code;
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 通过枚举<code>code</code>获得枚举
	 * 
	 * @param code
	 *            code
	 * @return AccountType
	 */
	public static PortState getByCode(String code) {
		for (PortState acType : values()) {
			if (acType.getCode().equals(code)) {
				return acType;
			}
		}
		return null;
	}

	@Override
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Override
	public String getMessage() {
		return this.name;
	}

}
